	/* 
	 * JTable solicitudes
	 */
	$(document).ready(function() {              
	    //setup the jtable that will display the results
	    $('#TablaListaSolicitudes').jtable({
	        title: ' ',
	        selecting: true, //Enable selecting 
	        paging: false, //Enable paging
	        pageSize: 10, //Set page size (default: 10)
	        sorting: true, //Enable sorting
            defaultSorting: 'Solicitudid ASC', //Set default sorting
	        actions: {
	        	listAction: 'getSolicitudesSinPag',
	        },
	        fields: {
	        	Solicitudid: {
	                title: 'ID',
	                width: '5%',
	                inputClass : 'validate[required]',
	    	        sorting: true,
	            },
	        	Usuarioid: {
	        		key: true,
	                visibility: 'hidden',
	            },
	            Fechalta: {
	                title: 'F. Alta',
	                width: '24%',
	                sorting: false
	            },
	            Centro: {
	                title: 'Centro',
	                width: '40%',
	                sorting: false
	            },
	            Usuario: {
	                title: 'Usuario',
	                width: '24%',
	                sorting: false
	            },
	            Solicitud: {
                    title: 'Procesar',
                    type: 'img',
                    create: false,
                    edit: false,
                    sorting: false,
                    list: true,
                    display: function(data){
                    		return '<a href="crear?id='+  data.record.Solicitudid + '" ><img Style="max-width: 100%;" src="/plantilla/images/solicitudes.png" width="35" height="17" class="preview"></a>';
                    }
                    
                },
	        },
	        
	      //Initialize validation logic when a form is created
            formCreated: function (event, data) {
                data.form.validationEngine();
            },
            //Validate form when it is being submitted
            formSubmitting: function (event, data) {
                return data.form.validationEngine('validate');
            },
            //Dispose validation logic when form is closed
            formClosed: function (event, data) {
                data.form.validationEngine('hide');
                data.form.validationEngine('detach');
            },
	        //Register to selectionChanged event to hanlde events                                     
	        recordAdded: function(event, data){
	            //after record insertion, reload the records
	            $('#TablaListaSolicitudes').jtable('load');
	        },
	        recordUpdated: function(event, data){
	            //after record updation, reload the records
	            $('#TablaListaSolicitudes').jtable('load');
	        }
	    });
	    
	    $('#TablaListaSolicitudes').jtable('load', {
            situacionid: $('#situacionid').val()
        });
	    
	    
	    //Re-load records when user click 'load records' button.
        /*$('#botonbuscar').click(function (e) {
            e.preventDefault();
            $('#TablaListaSolicitudes').jtable('load', {
                situacionid: 2,
                fechades: $('#fechades').val(),
                fechahas: $('#fechahas').val(),
                usuarioid:$('#usuarioid').val()
            });
        });
 
        //Load all records when page is first shown
        $('#botonbuscar').click();      */         
	});